import java.util.Objects;
import java.util.Scanner;

public class homework_4 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("请输入图形类型（a/b/c/d/e/f/g）：");
        String type="0";
        do {
            type = input.next();
            if(!Objects.equals(type, "a") && !Objects.equals(type, "b") && !Objects.equals(type, "c") && !Objects.equals(type, "d") && !Objects.equals(type, "e") && !Objects.equals(type, "f") && !Objects.equals(type, "g")){
                System.out.println("你只能输入“a/b/c/d/e/f/g”中的一个");
            }
        } while (!Objects.equals(type, "a") && !Objects.equals(type, "b") && !Objects.equals(type, "c") && !Objects.equals(type, "d") && !Objects.equals(type, "e") && !Objects.equals(type, "f") && !Objects.equals(type, "g"));
        double beforesize=0.0;
        int size=0;
        do {
            System.out.print("请输入图形大小：");
            beforesize = input.nextDouble();
            if(beforesize<=0.0){
                System.out.println("不能输入非正整数");
                continue;
            }
            size=(int)beforesize;
            if((double)size!=beforesize){
                System.out.println("不能输入带小数点的数");
                continue;
            }

        }while ((double) size!=beforesize);
        if (type.equals("a")) {//aaaaaaaaaaaaaaaa
            for (int i = 0; i < size; i++) {
                for (int j = 0; j <2*i; j++) {
                    System.out.print(" ");
                }
                for (int j = 2*(size-i)-1; j >0; j--) {
                    System.out.print("# ");
                }
                System.out.print("\n");
            }
        }
        if (type.equals("b")) {//bbbbbbbbbbbbbbbbbb
            for (int i = 0; i < size; i++) {
                for (int j = 2*(size - i); j > 0; j--) {
                    System.out.print(" ");
                }
                for (int j = 0; j < 2*i+1; j++) {
                    System.out.print("# ");
                }
                System.out.print("\n");
            }
        }if (type.equals("c")) {//cccccccccccccccccccc
            for (int i = 0; i < size; i++) {
                for (int j = 2*(size - i); j > 0; j--) {
                    System.out.print(" ");
                }
                for (int j = 0; j < 2*i+1; j++) {
                    System.out.print("# ");
                }
                System.out.print("\n");

            }
            for (int i = 1; i < size; i++) {
                for (int j = 0; j < 2*i+2; j++) {
                    System.out.print(" ");
                }
                for (int j = 2*(size-i)-1; j >0; j--) {
                    System.out.print("# ");
                }
                System.out.print("\n");
            }
        }if (type.equals("d")) {//ddddddddddddddddddd
            for (int i = 0; i < size; i++) {
                for (int j = 0; j <= i; j++) {
                    System.out.print((j+1)+" ");
                }
                System.out.print("\n");
            }
        }if (type.equals("e")) {//eeeeeeeeeeeeeeeeee
            for (int i = 0; i < size; i++) {
                for (int j = 0; j < 2*i; j++) {
                    System.out.print(" ");
                }
                for (int j = 0; j < (size-i); j++) {
                    System.out.print((j+1)+" ");
                }
                System.out.print("\n");
            }
        }if (type.equals("f")) {//ffffffffffffffffffffff
            for (int i = 0; i < size; i++) {
                for (int j = 2*(size - i); j > 0; j--) {
                    System.out.print(" ");
                }
                for (int j = i+1; j > 0; j--) {
                    System.out.print(j+" ");
                }
                System.out.print("\n");
            }
        }if (type.equals("g")) {//gggggggggggggggggggggggg
            for (int i = 0; i < size; i++) {
                for (int j = (size - i); j > 0; j--) {
                    System.out.print(j+" ");
                }
                System.out.print("\n");
            }
        }
        if(size>50){
            System.out.println("你输入的数字太大，可能会影响观看");
        }
    }
}